package com.admin.web.controller;

import com.bayss.core.constant.ResultMsg;
import com.bayss.core.service.StatisticalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 统计
 */
@RestController
public class StatisticalController extends ApiBaseController {
    @Autowired
    private StatisticalService statisticalService;


    /**
     * 柱状图-销量、下单量
     *
     * @param queryType 1-销售额；2-下单量
     * @param dateRange 1-本周；2-本月，3-本年
     * @return
     */
    @GetMapping(value = "/statistical/barChar.json")
    public ResultMsg barChar(Integer queryType, Integer dateRange) {
        return ResultMsg.success(statisticalService.barChar(queryType, dateRange));
    }

    /**
     * 总销售额、日均销售额、总支付笔数、日环比、周同比
     */
    @GetMapping(value = "/statistical/statisticalInfo.json")
    public ResultMsg statisticalInfo() {
        return ResultMsg.success(statisticalService.statisticalInfo());
    }

    /**
     *  支付笔数图
     */
    @GetMapping(value = "/statistical/getPayCountChart.json")
    public ResultMsg getPayCountChart() {
        return ResultMsg.success(statisticalService.getPayCountChart());
    }

}
